<?php

namespace app\api\model;

use think\Model;

class TeacherCourseCollect extends Model
{
    protected $autoWriteTimestamp = false;

    /**
     * 用户收藏
     */
    public static function getCollect($teacherCourseId, $userId)
    {
        return self::where('teacher_course_id', $teacherCourseId)->where('user_id', $userId)->find();
    }

    /**
     * 用户收藏的所有课程
     */
    public static function getByUserId($userId)
    {
        return self::where('user_id', $userId)->column('teacher_course_id');
    }
}
